package com.smarthealthring.mm.widgets;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by bilibili on 2018/6/5.
 */

public class ColorfulLine extends View {

    private Paint mPaint;

    public ColorfulLine(Context context, @Nullable AttributeSet attrs, Paint paint) {
        super(context, attrs);
        mPaint = new Paint();
        mPaint.setStrokeWidth(20);
        mPaint.setAntiAlias(true);
    }

    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        mPaint.setColor(Color.BLACK);
        canvas.drawLine(0, 0, 50, 0, mPaint);        //绘制直线
        mPaint.setColor(Color.RED);
        canvas.drawLine(0, 0, 50, 0, mPaint);      //绘制直线
        mPaint.setColor(Color.BLUE);
        canvas.drawLine(0, 0, 50, 0, mPaint);      //绘制直线
        mPaint.setColor(Color.GREEN);
        canvas.drawLine(0, 0, 50, 0, mPaint);      //绘制直线
    }
}
